﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            string program = "+++++++++++++++++++++++++++++++++++++++++++%>++++++++++++++++++++++++++++++++++++%>++++%>+%>+++++%>------------------------>!%>+++++++++++++++++++++++++++++++++++++++++++@";
            char[] memory = new char[8] ;

            for (int i = 0; i < memory.Length; i++)
            {
                memory[i] = ' ';

            }

            int pointer = 0;
            foreach (char ch in program)
            {
                switch (ch)
                {
                    case '!':
                        memory[pointer] = ' ';
                        break;
                    case '>':
                        if (pointer < memory.Length)
                        {
                            pointer++;
                        }
                        break;
                    case '<':
                        if (pointer > 0)
                        {
                            pointer--;
                        }
                        break;
                    case '+':
                        memory[pointer]++;
                        break;
                    case '-':
                        memory[pointer]--;
                        break;
                    case '%':
                        if (pointer + 1 < memory.Length)
                        {
                            memory[pointer + 1] = memory[pointer];
                        }
                        break;
                    case '@':
                        Console.Write(memory);
                        break;
                }

            }
            Console.ReadLine();
        }
    }
}